import json
import time
from functools import wraps


def save_json(file,jsonData):
    """
    保存json文件
    :param file:
    :param jsonData:
    :return:
    """
    with open(file, "w") as f:
        json.dump(json.loads(jsonData), f)
        print("加载入文件完成...")


def functime(func):
    """
    装饰器
    :param func:
    :return:
    """
    @wraps(func)
    def decorator(*args, **kwargs):
        start = time.clock()
        result = func(*args, **kwargs)
        end = time.clock()
        print(f'{func.__name__} Running time: %s Seconds' % (end - start))
        return result
    return decorator